;; ==== Original =======================================================

(define (say-names names)
  (if
   (null? names)
   (newline)
   (begin
     (display (car names))
     (newline)
     (say-names (cdr names)))))



;; ==== s-expression based ===================================================

;; Write a pure function to calculate s-expression that carries out
;; the same action as `Original` when passed to the Scheme `eval`
;; procedure.


;; (helper function for s:say-names since the `begin` is special)
(define (s:_say-names names)
  XXX)

;; (wrap the `begin` around what s:_say-names calculates)
(define (s:say-names names)
  XXX)

(TEST
 > (s:say-names '("Chris" "Jorge"))
 (begin
   (display "Chris")
   (newline)
   (display "Jorge")
   (newline)))


;; ==== class based =========================================================

;; Write a pure function to calculate a tree of actions that carries
;; out the same action as `Original` when passed to the `run-action`
;; procedure also defined below.

(defclass action
  (defclass (first-then-action [action? action1]
			       [action? action2]))
  (defclass (display-action [string? str]))
  (defclass (newline-action))
  (defclass (no-action)))

(define (a:say-names names)
  XXX)


(TEST
 > (a:say-names '())
 [(no-action)]
 > (show (a:say-names '()))
 (no-action)
 > (show (a:say-names '("Chris" "Jorge")))
 XXX)

(define (run-action action)
  (pmatch action
          (first-then-action?
           XXX)
          (display-action?
           XXX)
          (newline-action?
           XXX)
          (no-action?
           XXX)))
